<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="打印标签" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCancel(){
		window.close();
	}
	function doPrint(billId){
		var ob_arr = document.getElementsByName("itemCb");
		var itemIdStr="";
		for (i=0;i<ob_arr.length;i++){
			if ((ob_arr[i].checked == true)){
				if(itemIdStr!=""){
					itemIdStr=itemIdStr+";";
				}
				itemIdStr = itemIdStr+ob_arr[i].value;
			}
		}
		if(itemIdStr==""){
			ShowAlert('提示框','请选择要打印的项目',200,100);
		}else{
			showWin(400,300,"/business/BusinessBillPrint.ihtm?type=LABEL&item_id_str="+itemIdStr+"&id="+billId);
		}
	}
	function doPrintBill(billId){
		showWin(400,300,"/business/BusinessBillPrint.ihtm?type=LABEL&id="+billId);
	}
	function checkItemAll(obj){
		var ob_arr = document.getElementsByName("itemCb");
		for (i=0;i<ob_arr.length;i++){
			if(obj.checked){
				ob_arr[i].checked = true;
			}else{
				ob_arr[i].checked = false;
			}
		}
	}
	function doInit(){
	
	}
</script>
</head>
<body oncontextmenu="return false" onload="doInit();" class="sheet modal-dialog" style=" padding-top:10px;text-align:center;" >
<div class="sheet-main" id="bodyDiv" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-list" style="width:100%">
    <div class="modal-main search-business">
		<div style="width:100%;" style="+zoom:1;">
			<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
 				<tr>
 					<td style="width:33%" rowspan="2"></td>
 					<td style="width:33%;text-align:center" rowspan="2"><h2>打印产品标签</h2></td>
 					<td style="width:34%" class="tr">编号：${record.businessBill.billCode}</td>
 				</tr>
 				<tr>
 					<td class="tr">订货日期：<fmt:formatDate value="${record.businessBill.orderDate}" pattern="yyyy-MM-dd HH:mm"/></td>
 				</tr>
 			</table>
 			
 			<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
			    <tr>
 					<td class="InfoTitleDivider"></td>
 				</tr>
			</table>
 			
			<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-a2 BillElseInfo">
				<tr>
			      	<th style="width:10%">客户：</th>
			      	<td style="width:90%" colspan="5"><c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_CLIE_NAME;')==-1}">${record.clientName}</c:if></td>
			    </tr>
			    <tr>
			      	<th>工作中心：</th>
			      	<td style="width:23%">${wc.wcName}</td>
			      	<th style="width:10%">交货日期：</th>
			      	<td style="width:23%"><c:if test="${record.businessBill.deliverDate!=null}"><fmt:formatDate value="${record.businessBill.deliverDate}" pattern="yyyy-MM-dd HH:mm"/></c:if></td>
			      	<th style="width:10%">摘要：</th>
			      	<td style="width:24%">${record.businessBill.content}</td>
			    </tr>
			</table>
			
			<table border="0" cellspacing="0" cellpadding="0" align="center" class="table-0">
			    <tr>
 					<td class="InfoTitleDivider"></td>
 				</tr>
			</table>
			
			<div class="table-list">
				<table border="0" cellspacing="0" cellpadding="0" align="center" width="100%">
					<tr>
						<th width="14"><input type="checkbox" onClick="javascript:checkItemAll(this);"></th>
						<th width="12%" >项目类型</th>
						<th width="14%" >内容</th>
						<th width="14%" >材质</th>
						<th width="14%" >规格</th>
						<th width="16%" >制作要求</th>
						<th width="6%" >单位</th>
						<th width="8%" >数量</th>
						<th width="16%" >上次打印时间</th>
					</tr>
					<c:forEach var="item" items="${record.items}" varStatus="i">
					<tr>
						<td ><input type="checkbox" name='itemCb' index='${i.index}' value="${item.businessBillItem.id}" <c:if test="${item.businessBillItemExt.printNum==0}">checked="true"</c:if>></td>
						<td>${item.makeTypeName}</td>
						<td><commonTag:parseEnterToBr source="${item.businessBillItem.finishedContent}" /></td>
						<td>${item.businessBillItem.proName}</td>
						<td>
							<commonTag:parseEnterToBr source="${item.businessBillItem.specification}" />
							<c:if test="${item.businessBillItem.priceType=='AREA' || item.businessBillItem.priceType=='LENGTH'}"> x <commonTag:parseBigDecimal source="${item.businessBillItem.amount}" /></c:if>
						</td>
						<td><commonTag:parseEnterToBr source="${item.businessBillItem.makeRequire}" /></td>
						<td>
							<c:if test="${item.businessBillItem.priceType=='AREA'}">平方米</c:if>
							<c:if test="${item.businessBillItem.priceType=='LENGTH'}">
								<c:if test="${item.businessBillItem.lengType=='M'}">米</c:if><c:if test="${item.businessBillItem.lengType=='CM'}">公分</c:if>
							</c:if>
							<c:if test="${item.businessBillItem.priceType=='AMOUNT'}">${item.businessBillItem.unit}</c:if>
						</td>
						<td>
							<c:if test="${item.businessBillItem.priceType=='AREA' || item.businessBillItem.priceType=='LENGTH'}"><commonTag:parseBigDecimal source="${item.businessBillItem.squareNum}" /></c:if>
							<c:if test="${item.businessBillItem.priceType=='AMOUNT'}"><commonTag:parseBigDecimal source="${item.businessBillItem.amount}" /></c:if>
						</td>
						<td><c:if test="${item.businessBillItemExt.printNum>0}">${item.businessBillItemExt.lastPrinter} <fmt:formatDate value="${item.businessBillItemExt.printTime}" pattern="yyyy-MM-dd HH:mm"/> 第${item.businessBillItemExt.printNum}次</c:if></td>
					</tr>
					</c:forEach>
				</table>
			</div>
			
			<div class="blank12">&nbsp;</div>
			
		</div>
  	</div>
  </div>
	<div class="modal-buttom">
		<input type="button" class="buttom-a" value=" 打 印 " onClick="doPrint('${record.businessBill.id}');">
		<input type="button" class="buttom-a" value="打印单据标签" onClick="doPrintBill('${record.businessBill.id}');">
		<input type="button" class="buttom-a" value=" 退 出 " onClick="doCancel();">
	</div>  
</div>
</body>
</html>